import {
  IsString,
  IsNotEmpty,
  IsEmail,
  IsMobilePhone,
  Length,
  IsOptional,
} from 'class-validator';

export class UserRegisterDto {
  @IsString()
  @Length(2, 30)
  @IsNotEmpty()
  readonly username: string;

  @IsString()
  @Length(8, 32)
  @IsNotEmpty()
  readonly password: string;

  @IsOptional()
  @IsEmail()
  readonly email: string;

  @IsOptional()
  @IsMobilePhone('zh-CN')
  readonly phone: string;
}
